This forum is closed to new posts and
responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:
First of all, you should isolate the code you want to test, then you run it in the debugger in Notes, before you create an agent on the server to be called from the web.
I would remove all the MsgBox statements, as that will fill up the server log very quickly... And it makes your code harder to read.
I also consider it best practice to declare all variables at the beginning of each function/sub, not all over the code...
And you should add "Option Declare" at the beginning, that will help youfind things liek undeclared vriables. I can't see where datadoc is defined, for example...
That said, the code below should work:
Dim doc as NotesDocument
Dim currentdate As NotesDateTime
Dim docdate As NotesDateTime
... set doc here...
Set currentdate = New NotesDateTime(Now())
Set docdate = New NotesDateTime(doc.Created)
If docdate.DateOnly < currentdate.DateOnly Then
' Document created before today
Else
' Document created today
End If
I am using DateOnly as your code indicate that you just compare date, not the time.
If you want to compare the time as well, it is even easier:
Dim doc as NotesDocument
... set doc here...
If Cdat(doc.Created) < Cdat("1/1/2012") Then
' Document created last year or earlier
Else
' Document created this year
End if
Feedback response number WEBB8UTUZN created by ~Dan Kikiterobu on 05/31/2012